/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cgi.ndk.wf.controller;

import com.cgi.ndk.wf.service.ProcessServiceActiviti;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author kovalcikm
 */
@RestController
@RequestMapping("/v2/process")
public class ProcessControllerActiviti {

    @Autowired
    ProcessServiceActiviti processServiceActiviti;

    @RequestMapping(value = "/getAllProcesses", produces = "application/json")
    public Object getAllProcesses() {
        return processServiceActiviti.getAllProcesses();
    }

    @RequestMapping(value = "/startProcess", method = RequestMethod.POST, produces = "application/json", consumes = "application/json")
    public Object startProcess(@RequestBody Object startProcess) {
        return processServiceActiviti.startProcess(startProcess);
    }

    @RequestMapping(value = "/getProcessDetail/{instanceId}", method = RequestMethod.GET, produces = "application/json")
    public Object getProcessDetail(@PathVariable("instanceId") String instanceId) {
        return processServiceActiviti.getProcessDetail(instanceId);
    }
}
